package com.chixing.fourteen.controller;

import com.chixing.fourteen.service.CustomerOrderService;
import com.chixing.fourteen.service.ReceivingOrderService;
import com.chixing.fourteen.service.impl.CustomerOrderServiceImpl;
import com.chixing.fourteen.service.impl.ReceivingOrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/receivingOrder")
public class ReceivingOrderController {

    @Autowired
    private ReceivingOrderService receivingOrderService = new ReceivingOrderServiceImpl();

    @Autowired
    private CustomerOrderService customerOrderService = new CustomerOrderServiceImpl();

    @GetMapping("/create")
    public String createReceivingOrder(int driversId,int customerOrderId){
        receivingOrderService.create(driversId, customerOrderId);
        customerOrderService.changeStatus(customerOrderId,2);
        return "forward:/customerOrder/findAll?page=1";
    }


}
